package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 查询员工性别数据
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("查询员工性别数据");
       List<Map> gendeList=reportService.getEmpGenderData();
        return Result.success(gendeList);
    }


    /**
     * 查询各个职位的员工人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("查询各个职位的员工人数");
        JobOption jobOption =reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 学员学历统计
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getStuDegreeData(){
        log.info("学员学历统计");
        List<Map<String,Object>> stuDegreeList=reportService.getStuDegreeData();
        return Result.success(stuDegreeList);
    }

    /**
     * 班级人数统计
     */
    @GetMapping("/studentCountData")
    public Result getStuCountData(){
        log.info("班级人数统计");
        ClazzOption clazzOption =reportService.getStuCountData();
        return Result.success(clazzOption);
    }

}
